package com.example.mobile20306061550420classwork;

import android.os.Bundle;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

public class MainActivity extends AppCompatActivity {

    private TextView textView;
    private RecyclerView rvMainPart;
    private int[] partIds={R.drawable.ui_dipan01,R.drawable.ui_xuangua01,R.drawable.ui_fadongji01, R.drawable.ui_fangxiangpan01,R.drawable.ui_door01, R.drawable.ui_zhuoyi01,R.drawable.ui_luntai01};
    private String[] partNames={"汽车底盘","汽车悬挂","发动机","汽车方向盘","汽车门","汽车座椅","汽车轮胎",};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        rvMainPart.setLayoutManager(new LinearLayoutManager(this));
        PartRViewAdapter adapter=new PartRViewAdapter(partIds,partNames);
        rvMainPart.setAdapter(adapter);
    }

    private void initView() {
        textView = findViewById(R.id.textView);
        rvMainPart = findViewById(R.id.rvMainPart);
    }
}